package com.lanou.impl;

import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lanou.mapper.ConfigHouseMapper;
import com.lanou.pojo.ConfigHouseEntity;
import com.lanou.service.ConfigHouseService;
import com.lanou.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName ConfigHouseServiceImpl
 * @Description: TODO
 * @Author 郅占伟
 * @Date 2023年10月25日
 * @Version: 1.0
 */
@Service
public class ConfigHouseServiceImpl implements ConfigHouseService {

    @Autowired
    private ConfigHouseMapper configHouseMapper;
    @Override
    public String getConfigHouseByName(String pageNum,String pageSize, String companyName) {

        PageHelper.startPage(Integer.parseInt(pageNum),Integer.parseInt(pageSize));

        List<ConfigHouseEntity> configHouseEntities = configHouseMapper.selectShopInfoByCompany(companyName);

        PageInfo<ConfigHouseEntity> pageInfo = new PageInfo<>(configHouseEntities);
        JsonResult<Object> jsonResult = new JsonResult<>();
        jsonResult.setData(pageInfo);
        jsonResult.setStatus(200);

        return JSON.toJSONString(jsonResult);
    }
}
